home *** CD-ROM | disk | FTP | other *** search
/ Chip 2005 June / CHIP 2005-06.iso / program / e-is / OOo_2.0beta_tr_TR_WinIntel / openofficeorg2.cab / measure_conversion.xsl < prev    next >
Encoding:
Extensible Markup Language  |  2005-03-16  |  23.5 KB  |  421 lines

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3.  
  4.    $RCSfile: measure_conversion.xsl,v $
  5.  
  6.    $Revision: 1.5 $
  7.  
  8.    last change: $Author: obo $ $Date: 2004/11/18 10:09:03 $
  9.  
  10.    The Contents of this file are made available subject to the terms of
  11.    either of the following licenses
  12.  
  13.           - GNU Lesser General Public License Version 2.1
  14.           - Sun Industry Standards Source License Version 1.1
  15.  
  16.    Sun Microsystems Inc., October, 2000
  17.  
  18.    GNU Lesser General Public License Version 2.1
  19.    =============================================
  20.    Copyright 2000 by Sun Microsystems, Inc.
  21.    901 San Antonio Road, Palo Alto, CA 94303, USA
  22.  
  23.    This library is free software; you can redistribute it and/or
  24.    modify it under the terms of the GNU Lesser General Public
  25.    License version 2.1, as published by the Free Software Foundation.
  26.  
  27.    This library is distributed in the hope that it will be useful,
  28.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  29.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  30.    Lesser General Public License for more details.
  31.  
  32.    You should have received a copy of the GNU Lesser General Public
  33.    License along with this library; if not, write to the Free Software
  34.    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  35.    MA  02111-1307  USA
  36.  
  37.  
  38.    Sun Industry Standards Source License Version 1.1
  39.    =================================================
  40.    The contents of this file are subject to the Sun Industry Standards
  41.    Source License Version 1.1 (the "License"); You may not use this file
  42.    except in compliance with the License. You may obtain a copy of the
  43.    License at http://www.openoffice.org/license.html.
  44.  
  45.    Software provided under this License is provided on an "AS IS" basis,
  46.    WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING,
  47.    WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
  48.    MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
  49.    See the License for the specific provisions governing your rights and
  50.    obligations concerning the Software.
  51.  
  52.    The Initial Developer of the Original Code is: Sun Microsystems, Inc.
  53.  
  54.    Copyright ┬⌐ 2002 by Sun Microsystems, Inc.
  55.  
  56.    All Rights Reserved.
  57.  
  58.    Contributor(s): _______________________________________
  59.  
  60. -->
  61. <!--
  62.     For further documentation and updates visit http://xml.openoffice.org/sx2ml
  63. -->
  64. <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
  65.     <!-- DPI (dots per inch) the standard resolution of given pictures (necessary for the conversion of 'cm' into 'pixel')
  66.          Although many pictures have a 96 dpi resolution, a higher resoltion give better results for common browsers -->
  67.     <xsl:param name="dpi" select="111"/>
  68.     <xsl:param name="centimeter-in-mm" select="10"/>
  69.     <xsl:param name="inch-in-mm" select="25.4"/>
  70.     <xsl:param name="didot-point-in-mm" select="0.376065"/>
  71.     <xsl:param name="pica-in-mm" select="4.2333333"/>
  72.     <xsl:param name="point-in-mm" select="0.3527778"/>
  73.     <xsl:param name="twip-in-mm" select="0.017636684"/>
  74.     <xsl:param name="pixel-in-mm" select="$inch-in-mm div $dpi"/>
  75.     <!-- ***** MEASUREMENT CONVERSIONS *****
  76.       PARAM 'value'
  77.         The measure to be converted.
  78.         The current measure is judged by a substring (e.g. 'mm', 'cm', 'in', 'pica'...)
  79.         directly added to the number.
  80.  
  81.       PARAM 'rounding-factor'
  82.         Is used for the rounding of decimal places.
  83.         The parameter number is the product of 1 and some '10', where
  84.         every zero represents a decimal place.
  85.  
  86.         For example, providing as parameter:
  87.             <xsl:param name="rounding-factor" select="10000" />
  88.         Gives by default four decimal places.
  89.  
  90.         To round two decimal places, basically the following is done:
  91.             <xsl:value-of select="round(100 * value) div 100"/>
  92.  
  93.       RETURN    The converted number, by default rounded to four decimal places.
  94.                 In case the input measure could not be matched the same value is
  95.                 returned and a warning message is written out.
  96.  
  97.  
  98.  
  99.      MEASURE LIST:
  100.      * 1 milimeter (mm), the basic measure
  101.  
  102.      * 1 centimeter (cm) = 10 mm
  103.  
  104.      * 1 inch (in) = 25.4 mm
  105.         While the English have already seen the light (read: the metric system), the US
  106.         remains loyal to this medieval system.
  107.  
  108.      * 1 point (pt) = 0.35277777.. mm
  109.         Sometimes called PostScript point (ppt), as when Adobe created PostScript, they added their own system of points.
  110.         There are exactly 72 PostScript points in 1 inch.
  111.  
  112.      * 1 twip = twentieth of a (PostScript) point
  113.         A twip (twentieth of a point) is a 1/20th of a PostScript point, a traditional measure in printing.
  114.  
  115.      * 1 didot point (dpt) = 0.376065 mm
  116.         Didot point after the French typographer Firmin Didot (1764-1836).
  117.  
  118.         More details under
  119.         http://www.unc.edu/~rowlett/units/dictP.html:
  120.         "A unit of length used by typographers and printers. When printing was done
  121.         from hand-set metal type, one point represented the smallest element of type
  122.         that could be handled, roughly 1/64 inch. Eventually, the point was standardized
  123.         in Britain and America as exactly 1/72.27 = 0.013 837 inch, which is
  124.         about 0.35 mm (351.46 micrometers). In continental Europe, typographers
  125.         traditionally used a slightly larger point of 0.014 83 inch (about
  126.         1/72 pouce, 0.377 mm, or roughly 1/67 English inch), called a Didot point
  127.         after the French typographer Firmin Didot (1764-1836). In the U.S.,
  128.         Adobe software defines the point to be exactly 1/72 inch (0.013 888 9 inch
  129.         or 0.352 777 8 millimeters) and TeX software uses a slightly smaller point
  130.         of 0.351 459 8035 mm. The German standards agency DIN has proposed that
  131.         all these units be replaced by multiples of 0.25 millimeters (1/101.6 inch).
  132.  
  133.      * 1 pica = 4.233333 mm
  134.         1/6 inch or 12 points
  135.  
  136.      * 1 pixel (px) = 0.26458333.. mm   (relative to 'DPI', here: 96 dpi)
  137.         Most pictures have the 96 dpi resolution, but the dpi variable may vary by stylesheet parameter
  138.  
  139.  
  140.     -->
  141.     <!-- changing measure to mm -->
  142.     <xsl:template name="convert2mm">
  143.         <xsl:param name="value"/>
  144.         <xsl:param name="rounding-factor" select="10000"/>
  145.         <xsl:choose>
  146.             <xsl:when test="contains($value, 'mm')">
  147.                 <xsl:value-of select="substring-before($value, 'mm')"/>
  148.             </xsl:when>
  149.             <xsl:when test="contains($value, 'cm')">
  150.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm' ) * $centimeter-in-mm)) div $rounding-factor"/>
  151.             </xsl:when>
  152.             <xsl:when test="contains($value, 'in')">
  153.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in' ) * $inch-in-mm)) div $rounding-factor"/>
  154.             </xsl:when>
  155.             <xsl:when test="contains($value, 'pt')">
  156.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') * $point-in-mm)) div $rounding-factor"/>
  157.             </xsl:when>
  158.             <xsl:when test="contains($value, 'twip')">
  159.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') * $twip-in-mm)) div $rounding-factor"/>
  160.             </xsl:when>
  161.             <xsl:when test="contains($value, 'dpt')">
  162.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') * $didot-point-in-mm)) div $rounding-factor"/>
  163.             </xsl:when>
  164.             <xsl:when test="contains($value, 'pica')">
  165.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') * $pica-in-mm)) div $rounding-factor"/>
  166.             </xsl:when>
  167.             <xsl:when test="contains($value, 'px')">
  168.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') * $pixel-in-mm)) div $rounding-factor"/>
  169.             </xsl:when>
  170.             <xsl:otherwise>
  171.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'mm'!</xsl:message>
  172.                 <xsl:value-of select="$value"/>
  173.             </xsl:otherwise>
  174.         </xsl:choose>
  175.     </xsl:template>
  176.     <!-- changing measure to cm -->
  177.     <xsl:template name="convert2cm">
  178.         <xsl:param name="value"/>
  179.         <xsl:param name="rounding-factor" select="10000"/>
  180.         <xsl:choose>
  181.             <xsl:when test="contains($value, 'mm')">
  182.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $centimeter-in-mm)) div $rounding-factor"/>
  183.             </xsl:when>
  184.             <xsl:when test="contains($value, 'cm')">
  185.                 <xsl:value-of select="substring-before($value, 'cm')"/>
  186.             </xsl:when>
  187.             <xsl:when test="contains($value, 'in')">
  188.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $centimeter-in-mm * $inch-in-mm)) div $rounding-factor"/>
  189.             </xsl:when>
  190.             <xsl:when test="contains($value, 'pt')">
  191.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $centimeter-in-mm * $point-in-mm)) div $rounding-factor"/>
  192.             </xsl:when>
  193.             <xsl:when test="contains($value, 'dpt')">
  194.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $centimeter-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  195.             </xsl:when>
  196.             <xsl:when test="contains($value, 'pica')">
  197.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $centimeter-in-mm * $pica-in-mm)) div $rounding-factor"/>
  198.             </xsl:when>
  199.             <xsl:when test="contains($value, 'twip')">
  200.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $centimeter-in-mm * $twip-in-mm)) div $rounding-factor"/>
  201.             </xsl:when>
  202.             <xsl:when test="contains($value, 'px')">
  203.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $centimeter-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  204.             </xsl:when>
  205.             <xsl:otherwise>
  206.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'cm'!</xsl:message>
  207.                 <xsl:value-of select="$value"/>
  208.             </xsl:otherwise>
  209.         </xsl:choose>
  210.     </xsl:template>
  211.     <!-- changing measure to inch (cp. section comment) -->
  212.     <xsl:template name="convert2in">
  213.         <xsl:param name="value"/>
  214.         <xsl:param name="rounding-factor" select="10000"/>
  215.         <xsl:choose>
  216.             <xsl:when test="contains($value, 'mm')">
  217.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $inch-in-mm)) div $rounding-factor"/>
  218.             </xsl:when>
  219.             <xsl:when test="contains($value, 'cm')">
  220.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $inch-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  221.             </xsl:when>
  222.             <xsl:when test="contains($value, 'in')">
  223.                 <xsl:value-of select="substring-before($value, 'in')"/>
  224.             </xsl:when>
  225.             <xsl:when test="contains($value, 'pt')">
  226.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $inch-in-mm * $point-in-mm)) div $rounding-factor"/>
  227.             </xsl:when>
  228.             <xsl:when test="contains($value, 'dpt')">
  229.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $inch-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  230.             </xsl:when>
  231.             <xsl:when test="contains($value, 'pica')">
  232.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $inch-in-mm * $pica-in-mm)) div $rounding-factor"/>
  233.             </xsl:when>
  234.             <xsl:when test="contains($value, 'twip')">
  235.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $inch-in-mm * $twip-in-mm)) div $rounding-factor"/>
  236.             </xsl:when>
  237.             <xsl:when test="contains($value, 'px')">
  238.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $inch-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  239.             </xsl:when>
  240.             <xsl:otherwise>
  241.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'in'!</xsl:message>
  242.                 <xsl:value-of select="$value"/>
  243.             </xsl:otherwise>
  244.         </xsl:choose>
  245.     </xsl:template>
  246.     <!-- changing measure to dpt (cp. section comment) -->
  247.     <xsl:template name="convert2dpt">
  248.         <xsl:param name="value"/>
  249.         <xsl:param name="rounding-factor" select="10000"/>
  250.         <xsl:choose>
  251.             <xsl:when test="contains($value, 'mm')">
  252.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $didot-point-in-mm)) div $rounding-factor"/>
  253.             </xsl:when>
  254.             <xsl:when test="contains($value, 'cm')">
  255.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $didot-point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  256.             </xsl:when>
  257.             <xsl:when test="contains($value, 'in')">
  258.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $didot-point-in-mm * $inch-in-mm)) div $rounding-factor"/>
  259.             </xsl:when>
  260.             <xsl:when test="contains($value, 'pt')">
  261.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $didot-point-in-mm * $point-in-mm)) div $rounding-factor"/>
  262.             </xsl:when>
  263.             <xsl:when test="contains($value, 'dpt')">
  264.                 <xsl:value-of select="substring-before($value, 'dpt')"/>
  265.             </xsl:when>
  266.             <xsl:when test="contains($value, 'pica')">
  267.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $didot-point-in-mm * $pica-in-mm)) div $rounding-factor"/>
  268.             </xsl:when>
  269.             <xsl:when test="contains($value, 'twip')">
  270.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $didot-point-in-mm * $twip-in-mm)) div $rounding-factor"/>
  271.             </xsl:when>
  272.             <xsl:when test="contains($value, 'px')">
  273.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $didot-point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  274.             </xsl:when>
  275.             <xsl:otherwise>
  276.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'dpt'!</xsl:message>
  277.                 <xsl:value-of select="$value"/>
  278.             </xsl:otherwise>
  279.         </xsl:choose>
  280.     </xsl:template>
  281.     <!-- changing measure to pica (cp. section comment) -->
  282.     <xsl:template name="convert2pica">
  283.         <xsl:param name="value"/>
  284.         <xsl:param name="rounding-factor" select="10000"/>
  285.         <xsl:choose>
  286.             <xsl:when test="contains($value, 'mm')">
  287.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $pica-in-mm)) div $rounding-factor"/>
  288.             </xsl:when>
  289.             <xsl:when test="contains($value, 'cm')">
  290.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $pica-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  291.             </xsl:when>
  292.             <xsl:when test="contains($value, 'in')">
  293.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $pica-in-mm * $inch-in-mm)) div $rounding-factor"/>
  294.             </xsl:when>
  295.             <xsl:when test="contains($value, 'pt')">
  296.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $pica-in-mm * $point-in-mm)) div $rounding-factor"/>
  297.             </xsl:when>
  298.             <xsl:when test="contains($value, 'dpt')">
  299.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $pica-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  300.             </xsl:when>
  301.             <xsl:when test="contains($value, 'pica')">
  302.                 <xsl:value-of select="substring-before($value, 'pica')"/>
  303.             </xsl:when>
  304.             <xsl:when test="contains($value, 'twip')">
  305.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $pica-in-mm * $twip-in-mm)) div $rounding-factor"/>
  306.             </xsl:when>
  307.             <xsl:when test="contains($value, 'px')">
  308.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $pica-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  309.             </xsl:when>
  310.             <xsl:otherwise>
  311.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pica'!</xsl:message>
  312.                 <xsl:value-of select="$value"/>
  313.             </xsl:otherwise>
  314.         </xsl:choose>
  315.     </xsl:template>
  316.     <!-- changing measure to pt (cp. section comment) -->
  317.     <xsl:template name="convert2pt">
  318.         <xsl:param name="value"/>
  319.         <xsl:param name="rounding-factor" select="10000"/>
  320.         <xsl:choose>
  321.             <xsl:when test="contains($value, 'mm')">
  322.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $point-in-mm)) div $rounding-factor"/>
  323.             </xsl:when>
  324.             <xsl:when test="contains($value, 'cm')">
  325.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $point-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  326.             </xsl:when>
  327.             <xsl:when test="contains($value, 'in')">
  328.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $point-in-mm * $inch-in-mm)) div $rounding-factor"/>
  329.             </xsl:when>
  330.             <xsl:when test="contains($value, 'pt')">
  331.                 <xsl:value-of select="substring-before($value, 'pt')"/>
  332.             </xsl:when>
  333.             <xsl:when test="contains($value, 'dpt')">
  334.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $point-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  335.             </xsl:when>
  336.             <xsl:when test="contains($value, 'pica')">
  337.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $point-in-mm * $pica-in-mm)) div $rounding-factor"/>
  338.             </xsl:when>
  339.             <xsl:when test="contains($value, 'twip')">
  340.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'twip') div $point-in-mm * $twip-in-mm)) div $rounding-factor"/>
  341.             </xsl:when>
  342.             <xsl:when test="contains($value, 'px')">
  343.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $point-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  344.             </xsl:when>
  345.             <xsl:otherwise>
  346.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'pt'!</xsl:message>
  347.                 <xsl:value-of select="$value"/>
  348.             </xsl:otherwise>
  349.         </xsl:choose>
  350.     </xsl:template>
  351.     <!-- changing measure to pt (cp. section comment) -->
  352.     <xsl:template name="convert2twip">
  353.         <xsl:param name="value"/>
  354.         <xsl:param name="rounding-factor" select="10000"/>
  355.         <xsl:choose>
  356.             <xsl:when test="contains($value, 'mm')">
  357.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'mm') div $twip-in-mm)) div $rounding-factor"/>
  358.             </xsl:when>
  359.             <xsl:when test="contains($value, 'cm')">
  360.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'cm') div $twip-in-mm * $centimeter-in-mm)) div $rounding-factor"/>
  361.             </xsl:when>
  362.             <xsl:when test="contains($value, 'in')">
  363.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'in') div $twip-in-mm * $inch-in-mm)) div $rounding-factor"/>
  364.             </xsl:when>
  365.             <xsl:when test="contains($value, 'pt')">
  366.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pt') div $twip-in-mm * $point-in-mm)) div $rounding-factor"/>
  367.             </xsl:when>
  368.             <xsl:when test="contains($value, 'dpt')">
  369.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'dpt') div $twip-in-mm * $didot-point-in-mm)) div $rounding-factor"/>
  370.             </xsl:when>
  371.             <xsl:when test="contains($value, 'pica')">
  372.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'pica') div $twip-in-mm * $pica-in-mm)) div $rounding-factor"/>
  373.             </xsl:when>
  374.             <xsl:when test="contains($value, 'twip')">
  375.                 <xsl:value-of select="substring-before($value, 'twip')"/>
  376.             </xsl:when>
  377.             <xsl:when test="contains($value, 'px')">
  378.                 <xsl:value-of select="round($rounding-factor * number(substring-before($value, 'px') div $twip-in-mm * $pixel-in-mm)) div $rounding-factor"/>
  379.             </xsl:when>
  380.             <xsl:otherwise>
  381.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'twip'!</xsl:message>
  382.                 <xsl:value-of select="$value"/>
  383.             </xsl:otherwise>
  384.         </xsl:choose>
  385.     </xsl:template>
  386.     <!-- changing measure to pixel by via parameter provided dpi (dots per inch) standard factor (cp. section comment) -->
  387.     <xsl:template name="convert2px">
  388.         <xsl:param name="value"/>
  389.         <xsl:choose>
  390.             <xsl:when test="contains($value, 'mm')">
  391.                 <xsl:value-of select="round(number(substring-before($value, 'mm')) div $pixel-in-mm)"/>
  392.             </xsl:when>
  393.             <xsl:when test="contains($value, 'cm')">
  394.                 <xsl:value-of select="round(number(substring-before($value, 'cm')) div $pixel-in-mm * $centimeter-in-mm)"/>
  395.             </xsl:when>
  396.             <xsl:when test="contains($value, 'in')">
  397.                 <xsl:value-of select="round(number(substring-before($value, 'in')) div $pixel-in-mm * $inch-in-mm)"/>
  398.             </xsl:when>
  399.             <xsl:when test="contains($value, 'pt')">
  400.                 <xsl:value-of select="round(number(substring-before($value, 'pt')) div $pixel-in-mm * $point-in-mm)"/>
  401.             </xsl:when>
  402.             <xsl:when test="contains($value, 'dpt')">
  403.                 <xsl:value-of select="round(number(substring-before($value, 'dpt')) div $pixel-in-mm * $didot-point-in-mm)"/>
  404.             </xsl:when>
  405.             <xsl:when test="contains($value, 'pica')">
  406.                 <xsl:value-of select="round(number(substring-before($value, 'pica')) div $pixel-in-mm * $pica-in-mm)"/>
  407.             </xsl:when>
  408.             <xsl:when test="contains($value, 'twip')">
  409.                 <xsl:value-of select="round(number(substring-before($value, 'twip')) div $pixel-in-mm * $twip-in-mm)"/>
  410.             </xsl:when>
  411.             <xsl:when test="contains($value, 'px')">
  412.                 <xsl:value-of select="$value"/>
  413.             </xsl:when>
  414.             <xsl:otherwise>
  415.                 <xsl:message>measure_conversion.xsl: Find no conversion for <xsl:value-of select="$value"/> to 'px'!</xsl:message>
  416.                 <xsl:value-of select="$value"/>
  417.             </xsl:otherwise>
  418.         </xsl:choose>
  419.     </xsl:template>
  420. </xsl:stylesheet>
  421.